# Maintainer: Venji10 <bennisteinir@gmail.com>

# Reference: <https://postmarketos.org/devicepkg>
pkgname=device-xiaomi-beryllium
pkgdesc="Xiaomi Poco F1"
pkgver=0.1
pkgrel=1
url="https://postmarketos.org"
license="MIT"
arch="aarch64"
options="!check !archcheck"
depends="postmarketos-base mkbootimg"
makedepends="devicepkg-dev"
subpackages="
	$pkgname-nonfree-firmware:nonfree_firmware
	$pkgname-kernel-downstream:kernel_downstream
	$pkgname-kernel-mainline:kernel_mainline
"

source="deviceinfo"

build() {
	devicepkg_build $startdir $pkgname
}

package() {
	devicepkg_package $startdir $pkgname
}

nonfree_firmware() {
	pkgdesc="GPU, venus, modem firmware"
	depends="firmware-xiaomi-beryllium"
	mkdir "$subpkgdir"
}

kernel_downstream() {
	pkgdesc="USB, display (w/o HW acceleration) and touchscreen works (see device page in wiki for details)"
	depends="linux-xiaomi-beryllium mesa-dri-swrast"
	devicepkg_subpackage_kernel $startdir $pkgname $subpkgname
}

kernel_mainline() {
	pkgdesc="Close to mainline; USB and display works (see device page in wiki for details) (GPU firmware needed)"
	depends="linux-xiaomi-beryllium-mainline mesa-dri-freedreno"
	devicepkg_subpackage_kernel $startdir $pkgname $subpkgname
}

sha512sums="108a67ed5eb46dbac5a45fe0420b8b8f6db00ad130a6b5d8e44cbd0914bddab1bf7f1b16e5c06a4fa96dd65760269e45c2fbe5c37a3cdcd091a071e1af143458  deviceinfo"
